package com.shtel.bss.saas.core.biz.common.vo;


/**
 * @program: 测试
 * @description:返回的JSON数据结构标准
 * @author: mtb
 * @create: 2018-10-17 09:01
 **/
public class RetResponse<T> {
    private final static String SUCCESS = "success";

    public static <T> RetResult<T> makeOKRsp() {
        return new RetResult<T>().setCode(RetCode.SUCCESS).setMsg(SUCCESS);
    }

    public static <T> RetResult<T> makeOKRsp(T data) {
        return new RetResult<T>().setCode(RetCode.SUCCESS).setMsg(SUCCESS).setData(data);
    }

    public static <T> RetResult<T> makeErrRsp(int code,String message) {
        return new RetResult<T>().setCode(code).setMsg(message);
    }
    public static <T> RetResult<T> makeErrRsp(String message) {
        return new RetResult<T>().setCode(RetCode.FAIL).setMsg(SUCCESS);
    }

    public static <T> RetResult<T> makeRsp(int code, String msg) {
        return new RetResult<T>().setCode(code).setMsg(msg);
    }

    public static <T> RetResult<T> makeRsp(int code, String msg, T data) {
        return new RetResult<T>().setCode(code).setMsg(msg).setData(data);
    }



    public static RetResult makeErrorRsp(int code, String msg, String error, String path) {
        return new RetResult(code, error, msg, path);
    }

    public static RetResult makeErrorRsp(int code, String msg, String path) {
        return new RetResult(code, msg, path);
    }
    public static RetResult makeErrorRsp(int code, String msg) {
        return new RetResult(code, msg);
    }
}
